package org.deng.learn.mybatis.java.mapper;

import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.type.JdbcType;
import org.deng.learn.mybatis.entity.User;

import java.util.List;

/**
 * @Author DengLibin
 * @Date 19-4-27
 * @Time 下午10:47
 * @Desc
 */
public interface UserMapper {

    @Select("select id,name from user")
    @Results({
            @Result(column = "id", jdbcType = JdbcType.INTEGER, property = "id", javaType = Integer.class),
            @Result(column = "name", jdbcType = JdbcType.VARCHAR, property = "name", javaType = String.class),
    })
    List<User> query();

    @Update("update user set name=#{name} where id=#{id}")
    int update(User user);
}
